<%- include myCenterHeader.ejs %>
<h3 style="color: #d77a03"><b><%= __('mycenter').s_intive%></b></h3>


<div style="font-size: 18px;color: #9d9d9d;margin-top: 50px">
    <% if(datas.length==0){%>
    <div style="height: 200px;text-align: center">
        <span style="line-height: 200px"><%= __('findPartner').hint %>!!!!</span>
    </div>
    <hr style="border: none;border-top: 2px dotted #cac9c4;margin-left: -65px" >
    <%}%>
<% datas.forEach(function(data,index){%>
    <!--<span style="display: block"><% if(data.orderUser.username ==user.username){ %>我<% }else {%><%- data.orderUser.nickname%><% } %>在<%- data.orderCalendar.start%>邀请<%- data.orderToUser.nickname%>在<%- data.orderCoffee.addr%><%- data.orderCoffee.name%>咖啡馆见面</span>-->

    <span style="display: block"><%= __('orderList').m1 %><%- data.orderCalendar.start%><%= __('orderList').m2 %><%- data.orderToUser.nickname%><%= __('orderList').m3 %><%- data.orderCoffee.addr%><%- data.orderCoffee.name%><%= __('orderList').m4 %></span>

    <div style="width: 100px;float: left;margin-top: 20px">
        <img class="img-rounded" src="<%- data.orderToUser.headSrc%>" style="width: 60px;height: 60px">
    </div>
    <div style="margin-top: 20px;">
        <div style="width: 200px;float: left">
            <span style=""><%= __('partnerCenter').username %>：<%- data.orderToUser.nickname%></span><br>
            <span><%= __('partnerCenter').m_language %>：<%- data.orderToUser.language%></span><br>
            <span><%= __('partnerCenter').addr %>：<%- data.orderToUser.nowcity%></span>
        </div>
        <div style="width: 200px;float: left">
            <span><%= __('partnerCenter').gender %>：<% if(data.orderToUser.gender==0){%><%= __('partnerCenter').woman %><%}else{%><%= __('partnerCenter').male %><%}%></span><br>
            <span><%= __('partnerCenter').age %>：<%- data.orderToUser.age%></span><br>
            <span><%= __('partnerCenter').learn_language %>：<%- data.orderToUser.studylanguage%></span>
        </div>
    </div>

    <div style="clear: both;height: 20px"></div>
    <div style="float: left;margin-right: 20%;">
        <span style="font-size: 14px;color: #fca81a"><b><% if(data.state==0){%><%= __('orderList').state0 %><%}else if(data.state==1){%><%= __('orderList').state1 %><%}else{%><%= __('orderList').state2 %><%}%></b></span>
    </div>
    <div style="float: right;margin-right: 20%;">
        <span style="font-size: 14px;color: #fca81a"><b><%-data.orderDate.format('yyyy.MM.dd hh:mm:ss')%></b></span>
    </div>
    <hr style="border: none;border-top: 2px dotted #cac9c4;margin-left: -65px" >
<% }) %>
</div>
<div class="span12">
    <div id="page1"></div>
</div>
<%- include myCenterFooter.ejs %>
<script>
    function findOrderReply(id){
        $.ajax({
            type:"GET",
            url:"/findOrderReply?replyOrder="+id,
            dataType:"text",
            success:function(result){
                alert(result);
            }
        })
    }
    function goDelete(id){
        var prompt=confirm("你确定取消预约吗？？");

        if(prompt){

            window.location.href="/cancelOrder?id="+id;
        }
    }
    $(function(){
        //获得浏览器参数

        $.extend({
            getUrlVars: function(){
                var vars = [];
                var hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                console.log(hashes);
                for(var i = 0; i < hashes.length; i++){
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
                return vars;
            },
            getUrlVar: function(name){
                return $.getUrlVars()[name];
            }
        });

        //封装浏览器参数
        var composeUrlParams=function(){
            var param='';
            $.each($.getUrlVars(), function(i, item) {
                if(item!='num'){
                    var val=$.getUrlVar(item);
                    if(val) param += "&" + item+"="+val;
                }
            });
            return param;
        }
        var options = {
            currentPage:<%- page.num %>,                //当前页，css样式同其他页不同
            totalPages:<%- page.pageCount %>,           //总页数
            numberOfPages:5,                            //导航最多显示页数
            pageUrl: function(type, page, current) {    //页面跳转
                if(page!=<%- page.num %>){
                    return "/orderList?num="+ page+composeUrlParams();
                }

            }
        }
        $('#page1').bootstrapPaginator(options);
        WdatePicker({eCont:'showDate',onpicked:function(dp){
            alert('你选择的日期是:'+dp.cal.getDateStr());
        }
        })
    })
</script>